Задача финского школьника
Задача школьника
Графики
Plot[(*SqB[*)Sqrt[(*SpB[*)Power[x(*|*),(*|*)3](*]SpB*) + 1](*]SqB*), {x, -1.0, 2.0},
ImageSize -> {600, 400},
PlotLabel -> "Собственно нужно посчитать площадь под графиком",
AxesLabel -> {"x", "y"},
PlotStyle -> Red
]
Plotly[(*SqB[*)Sqrt[(*SpB[*)Power[x(*|*),(*|*)3](*]SpB*) + 1](*]SqB*), {x, -1.0, 2.0}, ImageSize -> {600, 400}]
Динамический график
{a, b} = {-1, 2};
n = 100;
d = (b - a) / n;
f[x_] := (*SqB[*)Sqrt[(*SpB[*)Power[x(*|*),(*|*)3](*]SpB*) + 1](*]SqB*);
fr[x_, d_] := {{x, 0}, {x, f[x+d]}, {x+d, f[x+d]}, {x+d, 0}};
rectangles = Table[fr[x, d], {x, a, b-d, d}];
Graphics[{
Red, Line[Offload[rectangles]],
Thick, Blue, Line[Table[{x, f[x]}, {x, a, b, 0.001}]]
}, Frame->True, ImageSize->{600, 400}]
slider = InputRange[3, 100, 1, "Label"->"Number of rectangles"]
EventHandler[slider, Function[$n, rectangles =
N@Table[fr[x, (b-a)/$n], {x, a, b, (b-a-d)/$n}]
]];
Сам численный интеграл
points = Table[f[x], {x, a+d, b, d}];
Length[points]
N @ Total[d * points]
N @ Sum[Sqrt[x^3+1] * d, {x, a+d, b, d}]
Аналитический интеграл
Integrate[(*SqB[*)Sqrt[(*SpB[*)Power[x(*|*),(*|*)6](*]SpB*) - 1](*]SqB*), x]